import { createRouter, createWebHistory } from 'vue-router'

// 导入路由组件
import SSO1 from '../components/SSO1.vue'    // SSO入口组件1
import SSO2 from '../components/SSO2.vue'    // SSO入口组件2
import Login from '../components/Login.vue'  // 登录页面组件
import Welcome from '../components/Welcome.vue' // 认证成功欢迎页

/**
 * 路由配置表
 * 定义应用的所有路由映射关系：
 * 1. path: URL路径
 * 2. name: 路由名称
 * 3. component: 对应的Vue组件
 */
const router = createRouter({
    history: createWebHistory(),
    routes:[
        {
            path: '/sso1',
            name: 'sso1',
            component: SSO1,
            meta: { requiresAuth: false }
        },
        {
            path: '/sso2',
            name: 'sso2',
            component: SSO2
        },
        {
            path: '/login',
            name: 'login',
            component: Login
        },
        {
            path: '/welcome',
            name: 'welcome',
            component: Welcome,
            meta: { requiresAuth: true }
        },
        // 根路径重定向配置
        { path: '/', redirect: '/sso1' }
    ]
})

export default router
